/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.general.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
//import javax.persistence.NamedQueries;
//import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ADMINISTRADOR
 */
@Entity
@Table(name = "gen_tipoUsuario")
//@NamedQueries({
//    @NamedQuery(name = "TipoUsuario.findAll", query = "SELECT t FROM TipoUsuario t"),
//    @NamedQuery(name = "TipoUsuario.findByTusCodigo", query = "SELECT t FROM TipoUsuario t WHERE t.tusCodigo = :tusCodigo"),
//    @NamedQuery(name = "TipoUsuario.findByTusNombre", query = "SELECT t FROM TipoUsuario t WHERE t.tusNombre = :tusNombre")})
public class TipoUsuario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "tus_codigo")
    private Integer tusCodigo;
    @Basic(optional = false)
    @Column(name = "tus_nombre")
    private String tusNombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tusCodigo", fetch = FetchType.LAZY)
    private List<UserExtMenu> userExtMenuList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tusCodigo", fetch = FetchType.LAZY)
    private List<UsuarioExterno> usuarioExternoList;

    public TipoUsuario() {
    }

    public TipoUsuario(Integer tusCodigo) {
        this.tusCodigo = tusCodigo;
    }

    public TipoUsuario(Integer tusCodigo, String tusNombre) {
        this.tusCodigo = tusCodigo;
        this.tusNombre = tusNombre;
    }

    public Integer getTusCodigo() {
        return tusCodigo;
    }

    public void setTusCodigo(Integer tusCodigo) {
        this.tusCodigo = tusCodigo;
    }

    public String getTusNombre() {
        return tusNombre;
    }

    public void setTusNombre(String tusNombre) {
        this.tusNombre = tusNombre;
    }

    public List<UserExtMenu> getUserExtMenuList() {
        return userExtMenuList;
    }

    public void setUserExtMenuList(List<UserExtMenu> userExtMenuList) {
        this.userExtMenuList = userExtMenuList;
    }

    public List<UsuarioExterno> getUsuarioExternoList() {
        return usuarioExternoList;
    }

    public void setUsuarioExternoList(List<UsuarioExterno> usuarioExternoList) {
        this.usuarioExternoList = usuarioExternoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tusCodigo != null ? tusCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoUsuario)) {
            return false;
        }
        TipoUsuario other = (TipoUsuario) object;
        if ((this.tusCodigo == null && other.tusCodigo != null) || (this.tusCodigo != null && !this.tusCodigo.equals(other.tusCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.general.be.TipoUsuario[tusCodigo=" + tusCodigo + "]";
    }

}
